package leetcode.offer_two_special.tree;

import leetcode.tree.common.TreeNode;

/**
 * @author mazouri
 * @create 2021-09-12 17:59
 */
public class _52_increasingBST {
    TreeNode head = new TreeNode();
    TreeNode cur = head;
    public TreeNode increasingBST(TreeNode root) {
        if (root.left!=null) increasingBST(root.left);

        cur.right = new TreeNode(root.val);
        cur = cur.right;

        if (root.right!=null) increasingBST(root.right);
        return head.right;
    }
}
